<template>
  <div class="login_page">
    <div class="aside_left">
      <div class="login_form">
       <div class="header">
        <img src="../assets/image/logo.png" alt="">
        <span>实践教学管理平台</span>
       </div>
        <el-form ref="form" :model="form">
          <el-form-item prop="user">
            <el-input v-model="form.account" placeholder="请输入用户名" prefix-icon="el-icon-user"></el-input>
          </el-form-item>
          <el-form-item prop="password">
            <el-input v-model="form.password" placeholder=" 请输入密码" show-password prefix-icon="el-icon-lock"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="login">登录</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'login',
  data() {
    return {
      form: {
        account: '',
        password: ''
      },
    }
  },
  methods: {
    login() {
      let url = this.$api.user.login
      this.$post(url,this.reqData({
        "account": this.form.account,
        "password": this.form.password,
      })).then(res => {
        if (res.data.code == 200) {
        let data = res.data.data
          this.$router.push('/personal');
          sessionStorage.setItem('user',JSON.stringify(data))
          console.log(res)
        } else {
          this.$message({
            type: 'error',
            message: '用户名或密码错误！'
          })
        }
      })
    }
  },
  mounted() {

  }
}
</script>

<style lang="less" scoped>
.login_page {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  background: linear-gradient(45deg, #009688, transparent);
  .aside_left {
    display: flex;
    align-items: center;
    justify-content: center;
    .login_form {
      position: relative;
      width: 5.3rem;
      height: 4.5rem;
      // padding: .2rem;
      box-sizing: border-box;
      background: rgba(255,255,255,0.35);
      border-radius: 0.08rem;
      border: 0.03rem solid rgba(255,255,255,0.9);
      box-shadow: 0px 0px 40px 0px rgba(0,0,0,0.05);
      &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        background: inherit;
        filter: blur(10px);
        z-index: -1;
      }
      .header {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 1rem;
        color: #fff;
        text-align: center;
        line-height: 1rem;
        font-size: 0.39rem;
        font-weight: 700;
        margin-bottom: 0.3rem;
        img {
          width: 0.39rem;
          height: 0.39rem;
          margin-right: 0.2rem;
        }
      }
      .el-form {
        padding: 0 0.2rem;
      }
      .el-form-item {
        margin-bottom: 0.35rem;
        text-align: center;
      }
      .el-input {
        height: 0.6rem;
        line-height: 0.6rem;
        /deep/ .el-input__inner {
          font-size: 0.18rem;
        }
      }
      .el-button {
        height: 0.5rem;
        width: 100%;
        line-height: 0.5rem;
        font-size: 0.2rem;
        padding: 0;
        background: #009688;
        color: #fff;
        font-weight: 900;
      }
    }
  }
}
</style>